<template>
  <el-row style="margin-bottom:0px;">
    <el-col :span="24">
      <div class="notice-head">
        <el-card class="box-card">
          <div slot="header" class="clearfix">
            <i class="el-icon-caret-bottom" />
            <span><el-link type="primary" :underline="false" style="font-size:18px;">{{ notice.topic }}</el-link></span>
          </div>
          <div style="padding-left:20px;padding-bottom:0px;line-height:20px;" v-html="context" />
          <div style="padding-left:10px;padding-top:10px;font-size:8px;">
            <el-tag size="mini" effect="plain" type="warning">公告时间：{{ parseTime(notice.updatedTime) }}</el-tag>
          </div>
        </el-card>
      </div>
    </el-col>
  </el-row>
</template>
<script>
import { parseTime } from '@/utils/index'
export default {
  props: {
    parent: {
      type: Object,
      default: null
    },
    notice: {
      type: Object,
      default: null
    },
    index: {
      type: Number,
      default: null
    }
  },
  data() {
    return {
    }
  },
  computed: {
    context() {
      /* var context = ''
      if (this.notice && this.notice.context) {
        var text = this.notice.context.replace('\r', '')
        var arr = text.split('\n')
        if (arr instanceof Array || arr.constructor === Array) {
          // context = arr.join('<br>')
          // context = context.replace(/[\t]/g, '&#09;')
          // context = context.replace(/[\s]/g, '&nbsp;')
          arr.forEach(item => {
            context += '<pre>' + item + '</pre>'
          })
        } else {
          context = text
        }
      }*/
      // return context
      return '<pre>' + this.notice.context + '</pre>'
    }
  },
  methods: {
    parseTime
  }
}
</script>
<style scoped>
.notice-head >>> .el-card__header {
  padding: 10px 0px 10px 20px;
}
.notice-head >>> .el-card__body {
  padding: 10px 0px 10px 20px;
}
.notice-head >>> pre{
  margin: 0px 0px;
}
</style>
